/*
* Versus.PandoraButton
*
* Written by Greg Zubankov (ss.greg@gmail.com).
* Copyright (c) 2007 Greg Zubankov.
*/

#ifndef VS_ENUMT_INC
#define VS_ENUMT_INC


namespace vs
{

  // EnumT
  // Replacement for std enums
  template <class T, typename T::Fake_ DefaultValue>
  class EnumT
    : public T
  {
  public:
    EnumT() : state_(DefaultValue) {}
    EnumT(typename T::Fake_ state) : state_(state) {}
    operator int() { return state_; }

  private:
    typename T::Fake_ state_;
  };

  // Example:
  // ---------------------------------------------------------------------
  //   struct MyStateBase
  //   {
  //      enum Fake_ { State1, State2, State3 };
  //   };
  //
  //   typedef EnumT<MyStateBase, MyStateBase::State1> MyState;
  //
  //   MyState state;
  //   state = MyState::State1;
  // ---------------------------------------------------------------------

} // namespace vs


#endif	// VS_ENUMT_INC
